<?php
/* Smarty version 3.1.34-dev-7, created on 2020-07-09 16:22:03
  from 'D:\php_demo\kindergarten\application\views\templates\admin\teacher_list.html' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '3.1.34-dev-7',
  'unifunc' => 'content_5f06d3abdb4137_08481165',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '3740fdcf628c899011aed834d65a96dc95c9a2d4' => 
    array (
      0 => 'D:\\php_demo\\kindergarten\\application\\views\\templates\\admin\\teacher_list.html',
      1 => 1594282018,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
  ),
),false)) {
function content_5f06d3abdb4137_08481165 (Smarty_Internal_Template $_smarty_tpl) {
?><!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>首页</title>
		<!-- import CSS -->
		<link href="https://cdn.bootcdn.net/ajax/libs/element-ui/2.13.2/theme-chalk/index.css" rel="stylesheet">
		<?php echo '<script'; ?>
 src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"><?php echo '</script'; ?>
>
		<!-- import Vue before Element -->
		<?php echo '<script'; ?>
 src="/html/vue.js"><?php echo '</script'; ?>
>
		<!-- import JavaScript -->
		<?php echo '<script'; ?>
 src="https://cdn.bootcdn.net/ajax/libs/element-ui/2.13.2/index.js"><?php echo '</script'; ?>
>
		<?php echo '<script'; ?>
 src="https://cdn.staticfile.org/axios/0.18.0/axios.min.js"><?php echo '</script'; ?>
>
	</head>
	<body>
		<div id="app" style='width: 100%; height: 100%;'>
			<el-container style="height: 100%; border: 1px solid #eee">
				<el-aside width="200px">
					<el-menu :default-openeds="['1', '3']">
						<el-submenu index="1">
							<template slot="title"><i class="el-icon-message"></i>文章</template>
							<el-menu-item-group>
								<template slot="title">分组一</template>
								<!-- <el-menu-item index="1-1" class="el-menu-item is-active"><el-link href="#">文章管理</el-link></el-menu-item> -->
								<el-link href="/index.php/admin_to/admin">
									<el-menu-item index="1-1">文章管理</el-menu-item>
								</el-link>
								<el-link href="/index.php/admin_to/write_news" target="_blank" :underline="false">
									<el-menu-item index="1-2">文章编写</el-menu-item>
								</el-link>
							</el-menu-item-group>
							<el-menu-item-group title="分组2">
								<el-link href="/index.php/admin_to/modify">
									<el-menu-item index="1-3">文章修改</el-menu-item>
								</el-link>
								<el-link href="/index.php/admin_to/view">
									<el-menu-item index="1-4">文章查看</el-menu-item>
								</el-link>
							</el-menu-item-group>
							<el-submenu index="1-4">
								<template slot="title">分类</template>
								<el-link href="/index.php/admin_to/classification">
									<el-menu-item index="1-4-1">文章分类</el-menu-item>
								</el-link>
							</el-submenu>
						</el-submenu>
						<el-submenu index="2">
							<template slot="title"><i class="el-icon-menu"></i>资源</template>
							<el-menu-item-group>
								<template slot="title">分组一</template>

								<el-link href="/index.php/admin_to/video_material">
									<el-menu-item index="2-1">视频管理</el-menu-item>
								</el-link>

								<el-menu-item index="2-2">选项2</el-menu-item>
							</el-menu-item-group>
							<el-menu-item-group title="分组2">
								<el-menu-item index="2-3">选项3</el-menu-item>
							</el-menu-item-group>
							<el-submenu index="2-4">
								<template slot="title">选项4</template>
								<el-menu-item index="2-4-1">选项4-1</el-menu-item>
							</el-submenu>
						</el-submenu>
						<el-submenu index="3">
							<template slot="title"><i class="el-icon-setting"></i>导航三</template>
							<el-menu-item-group>
								<template slot="title">分组一</template>

								<el-link href="#">
									<el-menu-item index="3-1" class="el-menu-item is-active">老师信息列表</el-menu-item>
								</el-link>

								<el-link href="#">
									<el-menu-item index="3-2">信息操作层</el-menu-item>
								</el-link>
							</el-menu-item-group>
							<el-menu-item-group title="分组2">
								<el-link href="/index.php/admin_to/course_list">
									<el-menu-item index="3-3">课程信息列表</el-menu-item>
								</el-link>
								<el-menu-item index="3-4">信息操作层</el-menu-item>
							</el-menu-item-group>
							<el-menu-item-group title="分组3">
								<el-link href="/index.php/admin_to/equipment_list">
									<el-menu-item index="3-5">设备信息列表</el-menu-item>
								</el-link>
								<el-menu-item index="3-6">信息操作层</el-menu-item>
							</el-menu-item-group>
							<el-submenu index="3-7">
								<template slot="title">选项4</template>
								<el-menu-item index="3-7-1">选项4-1</el-menu-item>
							</el-submenu>
						</el-submenu>
					</el-menu>
				</el-aside>

				<el-container>
					<el-header style="text-align: right; font-size: 12px">
						<el-dropdown @command="user_list">
							<i class="el-icon-setting" style="margin-right: 15px"></i>
							<el-dropdown-menu slot="dropdown">
								<el-dropdown-item command="a">查看</el-dropdown-item>
								<el-dropdown-item command="b">新增</el-dropdown-item>
								<el-dropdown-item command="c">退出登录</el-dropdown-item>
							</el-dropdown-menu>
						</el-dropdown>
						<span>{{ name }}</span>
					</el-header>
					<el-main>
						<h4>筛选</h4>
						<el-row style='margin-bottom: 40px;'>
							<el-col :span="6">
								<el-input v-model="like" placeholder="输入老师姓名"></el-input>
							</el-col>

							<el-col :span="6" style='margin-left: 10px;'>
								<el-button @click='go_where()'>查询</el-button>
							</el-col>
							<el-col :span="6">

							</el-col>
							<el-col :span="6">

							</el-col>
						</el-row>
						<el-divider></el-divider>

						<h4>增加</h4>
						<el-row style='margin-bottom: 40px;'>
							<el-col :span="6">

							</el-col>

							<el-col :span="6" style='margin-left: 10px;'>
								<el-button @click='go_add()' type="primary" plain>新增</el-button>
							</el-col>
							<el-col :span="6">

							</el-col>
							<el-col :span="6">

							</el-col>
						</el-row>

						<el-table :data="tableData" border style="width: 100%">
							<el-table-column fixed prop="name" label="名称" width="150">
							</el-table-column>
							<el-table-column prop="position" label="职位" width="120">
							</el-table-column>
							<el-table-column prop="power" label="权力" width="120">
							</el-table-column>
							<el-table-column label="操作" width="100">
								<template slot-scope="scope">
									<el-button @click="handleClick(scope.row)" type="text" size="small">编辑</el-button>
									<el-button @click="go_delete(scope.row)" type="text" size="small">删除</el-button>
								</template>
							</el-table-column>
						</el-table>
						<el-pagination style='margin-top: 20px;' background layout="prev, pager, next" :total="conunt" :page-size="limit">
						</el-pagination>
					</el-main>

				</el-container>
			</el-container>
		</div>
		<?php echo '<script'; ?>
>
			new Vue({
				el: '#app',
				data: function() {
					return {
						page: 1,
						limit: 25,
						like: "", //教师名字
						tableData: [],
						name: "admin",
						conunt: 1000,
						category_arrs: [{
							value: '1',
							label: '栏目A'
						}, {
							value: '2',
							label: '栏目B'
						}, {
							value: '3',
							label: '栏目C'
						}]
					}
				},
				methods: {
					go_session_null() {
						sessionStorage.setItem("teacher_id", "");
						sessionStorage.setItem("username", "");
						sessionStorage.setItem("position", "");
						sessionStorage.setItem("sex", "");
						sessionStorage.setItem("content", "");
						sessionStorage.setItem("power", "");
						sessionStorage.setItem("title_url", "");
					},
					handleClick(row) {
						var me = this;
						//console.log(row);
						me.go_session_null();
						sessionStorage.setItem("teacher_id", row.id);
						sessionStorage.setItem("username", row.name);
						sessionStorage.setItem("position", row.position);
						sessionStorage.setItem("sex", row.sex);
						sessionStorage.setItem("content", row.content);
						sessionStorage.setItem("power", row.power);
						sessionStorage.setItem("title_url", row.title_url);
						window.location.href = "/index.php/admin_to/teacher_operating";
					},
					go_where() {
						var me = this;
						axios.get('/index.php/server/teacher/select', {
								params: {
									page: me.page,
									limit: me.limit,
									like: me.like,
								}
							})
							.then(function(response) {
								//console.log(response);
								me.tableData = response.data;
							})
							.catch(function(error) { // 请求失败处理
								//console.log(error);
							});
					},
					go_delete(row) {
						var me = this;

						this.$confirm('此操作将永久删除, 是否继续?', '提示', {
							confirmButtonText: '确定',
							cancelButtonText: '取消',
							type: 'warning'
						}).then(() => {
							axios.get('/index.php/server/teacher/delete', {
									params: {
										id: row.id,
									}
								})
								.then(function(response) {
									//console.log(response);
									location.reload();
								})
								.catch(function(error) { // 请求失败处理
									//console.log(error);
								});
						}).catch(() => {
							this.$message({
								type: 'info',
								message: '已取消删除'
							});
						});
					},
					go_add() {
						sessionStorage.setItem("teacher_id", "");
						sessionStorage.setItem("username", "");
						sessionStorage.setItem("position", "");
						sessionStorage.setItem("sex", "");
						sessionStorage.setItem("content", "");
						sessionStorage.setItem("power", "");
						sessionStorage.setItem("title_url", "");
						window.location.href = "/index.php/admin_to/teacher_operating";
					},
					user_list(command) {
						if (command == "c") {
							axios.get('/index.php/server/login/ex_login', {
									params: {}
								})
								.then(function(response) {
									//console.log(response);							
									window.location.href = "/index.php/server/login/go";
									return
								})
								.catch(function(error) { // 请求失败处理
									//console.log(error);
								});

						}
						//console.log(command);
						var username = sessionStorage.getItem("name");
						if (username != 'admin') {
							this.$message({
								message: '只有admin账户拥有此权限！',
								type: 'warning'
							});
							return;
						}
						window.location.href = "/index.php/admin_to/user_list";
					}
				},
				mounted: function() {
					var me = this;
					me.name = sessionStorage.getItem("name");

					axios.get('/index.php/server/teacher/count', {
							params: {

							}
						})
						.then(function(response) {
							//console.log(response);
							me.conunt = response.data;
						})
						.catch(function(error) { // 请求失败处理
							//console.log(error);
						});

					axios.get('/index.php/server/teacher/select', {
							params: {
								page: me.page,
								limit: me.limit,
								like: me.like,
							}
						})
						.then(function(response) {
							//console.log(response);
							me.tableData = response.data;
						})
						.catch(function(error) { // 请求失败处理
							//console.log(error);
						});
				}
			})
		<?php echo '</script'; ?>
>
		<style>
			.el-header {
				background-color: #D9ECFF;
				color: #303133;
				line-height: 60px;
			}
		</style>
	</body>
</html>
<?php }
}
